package com.baizhi.mall.service.impl;

import com.baizhi.mall.entity.mysql.BzRoleResourceDO;
import com.baizhi.mall.mapper.BzRoleResourceMapper;
import com.baizhi.mall.service.IBzRoleResourceService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author zhw
 * @since 2021-05-17
 */
@Service
public class BzRoleResourceServiceImpl extends ServiceImpl<BzRoleResourceMapper, BzRoleResourceDO> implements IBzRoleResourceService {
    @Autowired
    private BzRoleResourceMapper rm;
    @Override
    public List<BzRoleResourceDO> selectAll() {
        List<BzRoleResourceDO> list=rm.selectList(null);
        return list;
    }

    @Override
    public void deleteByRole(Integer roleId) {
        rm.deleteByRoleId(roleId);
    }

    @Override
    public void insert(BzRoleResourceDO roleResource) {
        rm.insert(roleResource);
    }

    @Override
    @Transactional(readOnly = true)
    public List<BzRoleResourceDO> selectByRole(Integer roleId) {
        List<BzRoleResourceDO> list=rm.selectByRoleId(roleId);
        return list;
    }
}
